<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVoucherTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('voucher', function (Blueprint $table) {
            $table->increments('id');
            $table->string('type',16);//优惠价类型
            $table->string('distribute',16);//优惠券分配方式
            $table->string('title',60);//优惠价名称
            $table->decimal('price',10,2);//优惠价金额
            $table->decimal('lowest',10,2);//优惠价最低使用金额
            $table->text('description')->nullable();//优惠券描述
            $table->timestamp('start_time');//优惠券开始日期
            $table->timestamp('end_time')->nullable();//优惠券结束日期
            $table->integer('shop_uuid')->nullable();//有效店铺
            $table->integer('good_uuid')->nullable();//有效商品
            $table->integer('category_uuid')->nullable();//有效分类
            $table->integer('staff_uuid');//创建人
            $table->boolean('available')->default(true);//是否启用
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('voucher');
    }
}
